let path = require('path')
let cying_ip = "192.168.164.128"
let cying_port = 80

function resolve (dir) {
  return path.join(__dirname, dir)
}
module.exports = {

  publicPath: "./",
  outputDir: "build",
  assetsDir: "static",
  chainWebpack: config => {
    config.resolve.alias.set('@',         resolve('src'))

                        .set('@home',     resolve('src/views/home'))
                        .set('@login',    resolve('src/views/login'))
                        .set('@sign',     resolve('src/views/signin'))
                        .set('@task',     resolve('src/views/task'))
                        .set('@prof',     resolve('src/views/profile'))
                        .set('@dept',     resolve('src/views/department'))

                        .set('@guide',    resolve('src/components/global-guide'))
                        .set('@iload',    resolve('src/components/image-loader'))
                        
                        .set('@scss',     resolve('src/assets/scss'))
                        .set('@script',   resolve('src/assets/scripts'))
  },
  devServer: {
    port: 8080, // 端口号
    open: true, //配置自动启动浏览器
    proxy: {
      "/api": { 
        target: `http://${cying_ip}:${cying_port}/`, 
        changeOrigin: true,
        ws: true,
        pathRewrite: {
          '^/api': ''
        }
      },
      "/img": { 
        target: `http://${cying_ip}:${cying_port}/image/starsky/`, 
        changeOrigin: true,
        ws: true,
        pathRewrite: {
          '^/img': ''
        }
      }
    }
  }

}